#include "delay.h"
#include "string.h"
#include "stm32f4xx.h"
#include <stdio.h>
#include "main.h"

extern volatile uint64_t programState_restTicks;
extern double programState_ticksPerCnt;


void BSP_DelayUs(uint32_t n){
    programState_restTicks = n;
    while(programState_restTicks != 0);
}

void BSP_DelayMs(uint32_t n){
    programState_restTicks = n * 1000;
    while(programState_restTicks != 0);
}

void BSP_DelayUsInIrq(uint32_t n){
    int numCnt = (int)((double)n * programState_ticksPerCnt), i = numCnt;
    while(i != 0){
        i--;
    }
}

void BSP_DelayMsInIrq(uint32_t n){
    int numCnt = (int)((double)n * programState_ticksPerCnt * 1000), i = numCnt;
    while(i != 0){
        i--;
    }
}

